<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Responsive Flexbox Example</title>
  <link rel="stylesheet" href="styles.css">
  <style>
    /* 基本样式 */
    body {
      margin: 0;
      font-family: Arial, sans-serif;
    }

    .header,
    .nav,
    .main,
    .aside,
    .footer {
      padding: 20px;
      text-align: center;
    }

    .header {
      background-color: #f4b400;
    }

    .nav {
      background-color: #0f9d58;
    }

    .main {
      background-color: #db4437;
      flex: 1;
    }

    .aside {
      background-color: #4285f4;
    }

    .footer {
      background-color: #f4b400;
    }

    /* Flexbox 布局 */
    body {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }

    main {
      display: flex;
      flex: 1;
    }

    /* 媒体查询，用于窄屏设备 */
    @media (max-width: 720px) {
      body {
        width: 90% !important;
        padding: 0 !important;
        margin: 0 auto !important;
        min-width: 350px !important;
        flex-direction: column;
      }

      .main {
        flex-direction: column;
      }

      .nav,
      .aside {
        order: 0;
        /* 可选：根据需要调整顺序 */
      }
    }
  </style>
</head>

<body>
  <header class="header">Header</header>
  <nav class="nav">Navigation</nav>
  <main class="main">Main Content</main>
  <aside class="aside">Sidebar</aside>
  <footer class="footer">Footer</footer>
</body>

</html>